|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectga.core.algorithm.interactive.AbstractSIGA<T>
T - The generic type of individuals.public abstract class AbstractSIGA<T extends IIndividual<T>>
Abstract class for an simple interactive genetic algorithm.
| Field Summary | |
|---|---|
private java.lang.Thread |
accessThread
|
private GAContext |
context
|
private ICrossoverOp<T> |
crossoverOp
|
private IndividualList<T> |
evaluatingIndividuals
|
private IInteractiveFitnessEvaluator<T> |
evaluator
|
private IGALogger<T> |
gaLogger
|
private int |
generation
|
private static java.util.logging.Logger |
LOGGER
|
private IMutationOp<T> |
mutationOp
|
private IPopulation<T> |
population
|
private ISelector<T> |
selector
|
private boolean |
useEliteStrategy
|
private boolean |
validate
|
private IValidator<T> |
validator
|
| Fields inherited from interface ga.core.GA |
|---|
KEY_EVALUATED_INDIVIDUALS_MIN_COUNT, KEY_GENOME_MAX_LENGTH, KEY_GENOME_MIN_LENGTH, KEY_INIT_INDIVIDUAL, KEY_INIT_INDIVIDUAL_PERCENTAGE, KEY_INTERVAL_FITNESS_MAX_WIDTH, KEY_VALIDATION_SPACE |
| Constructor Summary | |
|---|---|
AbstractSIGA(IPopulation<T> population,
IInteractiveFitnessEvaluator<T> evaluator,
ISelector<T> selector,
IMutationOp<T> mutateOperator,
ICrossoverOp<T> crossoverOperator,
IValidator<T> validator,
boolean useEliteStrategy,
IGALogger<T> gaLogger)
Initializes the abstract class. |
|
| Method Summary | |
|---|---|
protected void |
checkThread()
Helper method to check if the current thread is the creation thread. |
void |
exit()
Exits the algorithm and frees resources. |
GAContext |
getContext()
Getter for the GA context. |
ICrossoverOp<T> |
getCrossoverOp()
Getter for the crossover operator. |
protected IndividualList<T> |
getEvaluatingIndividuals()
Getter for the list of individuals, that are currently being evaluated. |
protected IInteractiveFitnessEvaluator<T> |
getEvaluator()
Getter for the evaluator. |
protected IGALogger<T> |
getGALogger()
Getter for the ga logger. |
int |
getGeneration()
Getter for the current generation. |
IMutationOp<T> |
getMutationOp()
Getter for the mutation operator. |
IPopulation<T> |
getPopulation()
Getter for the population. |
protected ISelector<T> |
getSelector()
Getter for the selector. |
protected IValidator<T> |
getValidator()
Getter for the validator. |
protected void |
incGeneration()
Increments the current generation number. |
void |
init()
Initializes the algorithm and population. |
protected boolean |
isUseEliteStrategy()
Getter for the elite behavior. |
protected boolean |
isValidate()
Getter for the validation behavior. |
void |
setValidate(boolean validate)
Setter to enable/disable individual validation. |
void |
setValidator(IValidator<T> validator)
Set the individual validator for the algorithm. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ga.core.algorithm.interactive.ISIGA |
|---|
individualEvaluated, newIndividualRequested |
| Methods inherited from interface ga.core.GA |
|---|
step |
| Field Detail |
|---|
private static final java.util.logging.Logger LOGGER
private final java.lang.Thread accessThread
private final IGALogger<T extends IIndividual<T>> gaLogger
private final IPopulation<T extends IIndividual<T>> population
private final ISelector<T extends IIndividual<T>> selector
private final IInteractiveFitnessEvaluator<T extends IIndividual<T>> evaluator
private final IMutationOp<T extends IIndividual<T>> mutationOp
private final ICrossoverOp<T extends IIndividual<T>> crossoverOp
private IValidator<T extends IIndividual<T>> validator
private final GAContext context
private final IndividualList<T extends IIndividual<T>> evaluatingIndividuals
private boolean validate
private final boolean useEliteStrategy
private int generation
| Constructor Detail |
|---|
public AbstractSIGA(IPopulation<T> population,
IInteractiveFitnessEvaluator<T> evaluator,
ISelector<T> selector,
IMutationOp<T> mutateOperator,
ICrossoverOp<T> crossoverOperator,
IValidator<T> validator,
boolean useEliteStrategy,
IGALogger<T> gaLogger)
population - Population for the GA.evaluator - The automatic evaluator.selector - The selector.mutateOperator - The mutation operator.crossoverOperator - The crossover operator.validator - The validatoruseEliteStrategy - Use elite strategy or not.gaLogger - The ga logger.| Method Detail |
|---|
public void init()
GA
init in interface ISIGA<T extends IIndividual<T>>init in interface GA<T extends IIndividual<T>>protected void checkThread()
protected IGALogger<T> getGALogger()
protected ISelector<T> getSelector()
protected boolean isUseEliteStrategy()
true if should use elite strategy.public ICrossoverOp<T> getCrossoverOp()
ISIGA
getCrossoverOp in interface ISIGA<T extends IIndividual<T>>public IMutationOp<T> getMutationOp()
ISIGA
getMutationOp in interface ISIGA<T extends IIndividual<T>>protected IndividualList<T> getEvaluatingIndividuals()
protected boolean isValidate()
true if should validate individuals.protected IValidator<T> getValidator()
null if not set.protected IInteractiveFitnessEvaluator<T> getEvaluator()
public void setValidate(boolean validate)
GAtrue and a validator must be set.
setValidate in interface ISIGA<T extends IIndividual<T>>setValidate in interface GA<T extends IIndividual<T>>validate - Enable/disable validation.public void setValidator(IValidator<T> validator)
GAnull and validate must have been activated.
setValidator in interface ISIGA<T extends IIndividual<T>>setValidator in interface GA<T extends IIndividual<T>>validator - The individual validator.public IPopulation<T> getPopulation()
GA
getPopulation in interface ISIGA<T extends IIndividual<T>>getPopulation in interface GA<T extends IIndividual<T>>public GAContext getContext()
ISIGA
getContext in interface ISIGA<T extends IIndividual<T>>public int getGeneration()
ISIGA
getGeneration in interface ISIGA<T extends IIndividual<T>>protected void incGeneration()
public void exit()
ISIGA
exit in interface ISIGA<T extends IIndividual<T>>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||